﻿using HttpServer.HTTP;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace HttpServer.App_Start
{
    /**
     * 自定义HTTP启动类
     */
    public class HttpApplication
    {
        private WebServer server;
        private int port;


        public HttpApplication(int p)
        {
            this.port = p;
        }


        public async Task Run()
        {
            try
            {
                server = new WebServer(port);
                await server.StartHttpServer();
                MessageBox.Show("HTTP服务启动成功！", "提示");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示");
            }
        }
    }
}
